package com.city.helper;


import com.city.format.EvaluatesFormat;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EvalutesRespontory extends JpaRepository<EvaluatesFormat,Integer> {

    @Query(value = "select c.id id, u.name name,c.create_time start_time,c.deadline end_time,c.address addr ,c.content content,c.comment comment " +
            "from ct_report c, pub_user u " +
            "where c.handle_man_id=u.id limit ?1,?2", nativeQuery = true)
    List<EvaluatesFormat> findAllByLimit(Integer page, Integer limit);

    @Query(value = "select c.id id, u.name name,c.create_time start_time,c.deadline end_time,c.address addr ,c.content content,c.comment comment " +
            "from ct_report c, pub_user u " +
            "where c.handle_man_id=u.id AND c.id = ? ", nativeQuery = true)
    List<EvaluatesFormat> findAllById(Integer id);


}
